package com.jessechanrui.template.thread.threadlocal;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author chenrui
 * @date 2024/12/26
 */
public class Foo {
    static final AtomicInteger AMOUNT = new AtomicInteger();
    int index;
    int bar = 0;

    public Foo() {
        index = AMOUNT.incrementAndGet(); //总数增加， 并且给对象的编号
    }

    public int getBar() {
        return bar;
    }

    public void setBar(int bar) {
        this.bar = bar;
    }

    @Override
    public String toString() {
        return index + "Foo{" +
                "bar=" + bar +
                '}';
    }
}
